# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        博智科技  
# Name:         demo1413
# Description:
# Author:       yzl
# Date:         2019-02-10
#-------------------------------------------------------------------------------


import xmltodict

f = open('files/products.xml','rt',encoding='utf-8')
xml = f.read()
d = xmltodict.parse(xml)
f.close()
print(d)

import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(d)

# d = dict(d)
#
print(dict(d['root'])['products']['product'][0]['@uuid'])
# 取值操作
print(d['root']['products']['product'][0]['@uuid'])
print(d['root']['products']['product'][1]['id'])
